<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>使用?!断言限制用户名关键字</title>
  </head>
  <body>
    <main>
      <input type="text" name="username" />
    </main>
  </body>
  <script>
    //?!
    const input = document.querySelector("[name='username']");
    input.addEventListener("keyup", (e) => {
      const reg = /^(?!.*向军.*)[a-z]{3,6}$/i;
      console.log(e.target.value.match(reg));
    });
  </script>
</html>
